// @ts-ignore
import { api } from '@/utils/api';

/** 用户自己修改密码接口 POST /orgUserInfo/self/password */
export async function orgUserInfoSelfPassword(
  body: BASE.UpdatePasswordDTO,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResult>;

export async function orgUserInfoSelfPassword(
  body: BASE.UpdatePasswordDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResult>>;

export async function orgUserInfoSelfPassword(
  body: BASE.UpdatePasswordDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResult>;

export async function orgUserInfoSelfPassword(
  body: BASE.UpdatePasswordDTO,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResult>(`/app/orgUserInfo/self/password`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResult>(`/app/orgUserInfo/self/password`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}

/** 修改系统用户密码接口 POST /orgUserInfo/update/password */
export async function orgUserInfoUpdatePassword(
  body: BASE.UpdatePasswordDTO,
  options?: ArgumentsType<typeof api>[1]
): Promise<BASE.IResult>;

export async function orgUserInfoUpdatePassword(
  body: BASE.UpdatePasswordDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: true }
): Promise<TupleResponse<BASE.IResult>>;

export async function orgUserInfoUpdatePassword(
  body: BASE.UpdatePasswordDTO,
  options?: ArgumentsType<typeof api>[1] & { tupleResponse: false }
): Promise<BASE.IResult>;

export async function orgUserInfoUpdatePassword(
  body: BASE.UpdatePasswordDTO,
  options?: ArgumentsType<typeof api>[1]
) {
  if (
    (
      options as ArgumentsType<typeof api>[1] & {
        tupleResponse: boolean;
      }
    )?.tupleResponse === true
  ) {
    return api<BASE.IResult>(`/app/orgUserInfo/update/password`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      data: body,
      ...(options || {}),
      tupleResponse: true
    });
  }

  return api<BASE.IResult>(`/app/orgUserInfo/update/password`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    data: body,
    ...(options || {})
  });
}
